import json


def get_code(status, text):
    return json.dumps({
        "code": status,
        "msg": text
    })


def get_success_code_with_data(data_name, data):
    return json.dumps({
        "code": 1,
        data_name: data
    })


INPUT_ERROR = get_code(1000, "请输入参数")

LOGIN_SUCCESS = get_code(1, "登录成功")
LOGIN_FIRST = get_code(1001, "请先登录")
LOGIN_PASSWORD_ERROR = get_code(1002, "密码错误")
LOGIN_USER_NOT_FOUND = get_code(1003, "用户不存在")

REGISTER_SUCCESS = get_code(1, "注册成功")
REGISTER_USER_EXIST = get_code(1010, "用户已存在")
REGISTER_NOT_ALLOW = get_code(1020, "注册已关闭")

LOGOUT_SUCCESS = get_code(1, "退出登录成功")

TAG_ADD_SUCCESS = get_code(1, "插入书签成功")
TAG_DEL_SUCCESS = get_code(1, "删除书签成功")
TAG_DEL_FAIL = get_code(1101, "删除书签失败")
TAG_MOVE_SUCCESS = get_code(1, "移动书签成功")
TAG_MOVE_FAIL = get_code(1102, "移动书签失败")

CATEGORY_ADD_SUCCESS = get_code(1, "添加分类成功")
CATEGORY_EXIST = get_code(1201, "分类已存在")
CATEGORY_DEL_SUCCESS = get_code(1, "删除分类成功")
CATEGORY_DEL_FAIL = get_code(1202, "删除分类失败")
